<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>5、从两个数组里生成最小数字</title>
</head>

<body>
  <script>
    var minNumber = function (nums1, nums2) {
      nums1.sort((a, b) => a - b);
      nums2.sort((a, b) => a - b);
      for (let i = 1; i <= minNumber.length; i++) {
        if (nums1.includes(i) && nums2.includes(i)) {
          return i;
        }
      }
      return Math.min(nums1[0] * 10 + nums2[0], nums2[0] * 10 + nums1[0]);
    };
    console.log(minNumber([3, 5, 2, 6], [3, 1, 7, 5, 2, 6, 1, 8, 9, 2]))
  </script>
</body>

</html>